/*
ajax请求函数模块
返回值: promise对象(返回: response.data)
 */
import iView from 'iview';

class view {
    static showMsg(message, type = 'warning') {
        if (type === 'success') {
            iView.Notice.success({
                title: message
            });
        } else if (type === 'warning') {
            iView.Notice.warning({
                title: message
            });
        } else if (type === 'error') {
            iView.Notice.error({
                title: message
            });
        } else {
            iView.Notice.info({
                title: message
            });
        }

    }
    static startLoginbar() {
        iView.LoadingBar.start();
    }
    static finishLoginbar() {
        iView.LoadingBar.finish();
    }
    static errorLoginbar() {
        iView.LoadingBar.error();
    }
    static showLoad() {
        iView.Spin.show({
            render: (h) => {
                return h('div', [
                    h('Icon', {
                        'class': 'demo-spin-icon-load',
                        props: {
                            type: 'ios-loading',
                            size: 64
                        }
                    }),
                    h('div', '请稍等...')
                ])
            }
        });

    }
    static hideLoad() {
        iView.Spin.hide();
    }


}
export default view;